public class Demo1_2 {
    //求出1-100的奇数和与偶数和
    public static void main(String[] args) {
        int i = 1;
        int sumOdd = 0;
        int sumEve = 0;
        while (i <= 100) {
            if (i % 2 == 1) {
                sumOdd += i;
            } else {
                sumEve += i;
            }
            i++;
        }
        System.out.println("奇数和为：" + sumOdd);
        System.out.println("偶数和为：" + sumEve);
    }
}
